package main

import "fmt"

//结构体

type person struct {
	name string
	age int
	sex string
	hobby []string
}

func main() {
	//声明一个person类型的变量
	var xiaoyuting person
	//字段赋值
	xiaoyuting.name = "肖禹庭"
	xiaoyuting.age = 18
	xiaoyuting.sex = "男"
	xiaoyuting.hobby = []string{"篮球", "足球", "双色球"}

	fmt.Printf("%T\n", xiaoyuting)
	fmt.Println(xiaoyuting)
	fmt.Println(xiaoyuting.name)

	a := xiaoyuting
	fmt.Println(a)
	//main.person
	//{肖禹庭 18 男 [篮球 足球 双色球]}

	// 匿名结构体 临时使用
	var s struct{
		x string
		y int
	}
	s.x = "哈哈"
	s.y = 22
	fmt.Printf("%T:%v", s, s)
//	struct { x string; y int }:{哈哈 22}


}
